package com.xiaoran.RMQ_1.test7_Topic;

import com.rabbitmq.client.*;
import com.xiaoran.RMQ_1.utlis.RabbitMqUtils;

public class Topic_Consumer_1 {
    public static final String name="topic_logs";
    public static void main(String args[]) throws  Exception{
     Channel channel= RabbitMqUtils.getChannel();
     channel.exchangeDeclare(name,BuiltinExchangeType.TOPIC);
     channel.queueDeclare("Q1",false,false,false,null);
     channel.queueBind("Q1",name,"*.orange.*");
     DeliverCallback deliverCallback=(consumerTag,message)->{
         System.out.println("获取到的消息是："+new String(message.getBody()));
     };
     CancelCallback cancelCallback=consumerTag->{

     };
     channel.basicConsume("Q1",true,deliverCallback,cancelCallback);
    }
}
